package top.glkj.hms.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * 基类
 *
 * @author : xgl
 * @version : 0.0.1
 * @date :2020/11/1 12:53
 */
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@MappedSuperclass
public class BaseEntity implements Serializable {
    static final long serialVersionUID = 20000213L;
    /**
     * 主键
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    /**
     * 删除标记
     */
    @Column(name = "is_del", nullable = false)
    private boolean isDel;
    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Column(name = "create_time", nullable = false)
    private Date createTime;
    /**
     * 更新时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Column(name = "update_time", nullable = false)
    private Date updateTime;
    /**
     * 创建用户
     */
    @Column(name = "create_user_id")
    private Long createUserId;
    /**
     * 修改用户
     */
    @Column(name = "update_user_id")
    private Long updateUserId;
    public BaseEntity(Long id) {
        this.id = id;
    }
}
